package edu.ynu.se.xiecheng.achitectureclass.entity;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.awt.*;
import java.util.Set;

@Entity
@Getter
@Setter
@Where(clause = "is_deleted = 0")
public class Commodity extends LogicEntity{
    @Column
    private String commodityName;

    @Column
    private String commodityDescription;



    @Lob
    @Column(name = "image", columnDefinition = "BLOB")
    private byte[] image;

    @Column
    private double price;

    @ManyToOne(fetch = FetchType.LAZY)
    @JsonIgnoreProperties("commodities")
    private Business business;

    @OneToMany(mappedBy = "commodity",
            fetch = FetchType.LAZY,
            cascade = CascadeType.ALL)
    @JsonIgnoreProperties("commodity")
    private Set<OrderItem> orderItems;





}
